package com.tree.jvm.heap;

/**
 * @ClassName com.tree.jvm.gc.mem
 * Description: <类功能描述>. <br>
 * <p>
 * 检查内存大小
 *
 * -Xmx20M -Xms5M
 *
 * </p>
 * @Author tree
 * @Date 2019-11-16 12:18
 * @Version 1.0
 */
public class CheckMem {
    public static void main(String[] args) {
        byte[] b = new byte[4 *1024*1024];
        byte[] b1= new byte[24 *1024*1024];
        System.out.println("分配了4M空间给数组");
        Runtime runtime = Runtime.getRuntime();
        System.out.println("最大内存"+runtime.maxMemory()/1024/1024+"M");
        System.out.println("可用内存"+runtime.freeMemory()/1024/1024+"M");
        System.out.println("使用内存"+runtime.totalMemory()/1024/1024+"M");
    }
}
